<template>
	<view class="servicedetaile">
		<view class="sertopimg">
			<view class="ser_shoadow"></view>
		</view>
		<!-- <view class="servicedetaile_top">可申请<view class="servicedetaile_top_number">1</view>次</view> -->
		<view class="ser_detaile_box">
			<view class="ser_detale_title">{{detailedata.title}}</view>
			<view class="servicedetaile_textbox">
				<view class="textbox_left">
					求助人信息：
				</view>
				<view class="textbox_right">
					{{detailedata.linkUser}}
				</view>
			</view>
			<view class="servicedetaile_textbox">
				<view class="textbox_left">
					所在街道：
				</view>
				<view class="textbox_right">
					{{detailedata.orgName}}
				</view>
			</view>
			<view class="servicedetaile_textbox">
				<view class="textbox_left">
					服务类型：
				</view>
				<view class="textbox_right">
					{{typetext}}
				</view>
			</view>
			<view class="servicedetaile_textbox">
				<view class="textbox_left">
					期望服务时间：
				</view>
				<view class="textbox_right">
					{{detailedata.serviceTime}}
				</view>
			</view>
			<view style="padding-top: 30rpx;">
				<view style="font-weight: 700">
					服务描述
				</view>

				<view class="servicedetaile_textboxs">
					{{detailedata.comment}}
				</view>
			</view>
		</view>
		<view class="service_bottom">
			<button type="default" @click="open">我要接单</button>
			<!-- <button type="default" style="background-color: #b4bac1;">已结束</button> -->
		</view>

	</view>
</template>

<script module="tools" lang="wxs" src="../../utils/tools.wxs"></script>

<script>
	import {
		serviceAddDetail,
		addService,
		gettypelist,
		doService
	} from '../../api/order.js'
	var t = require("../../utils/request.js"),
		config = require("../../utils/config.js").config,
		e = function(t) {
			return t && t.__esModule ? t : {
				default: t
			};
		}(require("../../utils/api.js")),
		a = require("../../utils/util.js"),
		app = getApp(),
		n = e.default.recruitDetail,
		recruitList = e.default.recruitList,
		recruitSignUpStatus = e.default.recruitSignUpStatus,
		o = e.default.messageList,
		s = e.default.recruitSignUp,
		r = e.default.recruitCancelSign,
		orgDetailApi = e.default.orgDetail;

	export default {
		data() {
			return {
				id: '',
				typelist: [],
				typetext: '',
				detailedata: {}
			};
		},
		onLoad: function(t) {
			this.id = t.id
			this.getorderdetail()
		},
		methods: {

			open() {
				let data = {
					"addId": this.id,
					"volunteerId": app.globalData.zyzId,
				}
				doService(data).then((result => {
					console.log(result)
					if (result.success) {
						uni.showToast({
							title: "接单成功",
							icon: "success",
							duration: 2000
						})
						setTimeout(function() {
							uni.navigateTo({
								url: "/pages/order/order",

							});
						}, 1000);
					} else {
						uni.showToast({
							title: result.message,
							icon: "none",
							duration: 2000
						})
					}
				}));
			},
			gettypelist: function() {
				gettypelist().then((ret) => {
					console.log(ret)
					this.typelist = ret.data
					for (let i in this.typelist) {
						if (this.typelist[i].code == this.detailedata.serviceType) {
							this.typetext = this.typelist[i].value
						}
					}
				})

			},
			getorderdetail() {
				serviceAddDetail({
					id: this.id
				}).then((ret) => {
					if (ret.success) {
						console.log(ret)
						this.detailedata = ret.data
						this.detailedata.serviceTime = this.detailedata.serviceTime.substring(0, 10);
						// this.detailedata.endTime = this.detailedata.endTime.substring(0, 10);
						this.gettypelist()
					}
				})
			},
			getRecruitDetail: function() {

				uni.showToast({
					title: t.data.message,
					icon: "none"
				});
			},
		}
	};
</script>
<style>
	.servicedetaile {
		position: relative;
	}

	.sertopimg {
		position: relative;
		width: 100%;
		height: 500rpx;
		/*background-image: url(../../static/images/3.jpg); */
		background: url(../../static/images/back2.png) no-repeat 50%;
		background-size: 100% 100%;
	}

	.ser_shoadow {
		position: absolute;
		content: "";
		display: block;
		left: 0;
		bottom: 0;
		width: 100%;
		height: 1.333333rem;
		background: linear-gradient(180deg, hsla(0, 0%, 100%, 0), #fff);
	}

	.ser_detaile_box {
		position: relative;
		z-index: 3;
		width: 92%;
		height: auto;
		margin: 0 auto;
		margin-top: -360rpx;
		background: #FFF;
		border-radius: .266667rem;
		box-shadow: 0 1rpx 10rpx #939393;
		padding: 1rem;
	}

	.ser_detale_position {
		margin-bottom: 30rpx;
	}

	.ser_detale_position image {
		width: 25rpx;
		height: 25rpx;
	}

	.ser_detale_positiontext {
		margin-left: 20rpx;
		display: inline;
		font-size: 24rpx;
		line-height: 50rpx;
		color: #333333;
	}

	.ser_detale_title {
		font-size: 36rpx;
		margin-bottom: 30rpx;
	}

	.servicedetaile_top {
		position: absolute;
		top: 1.333333rem;
		right: .866667rem;
		z-index: 3;
		display: inline-block;
		height: 1.5rem;
		line-height: 1.5rem;
		padding: 0 .266667rem;
		background: hsla(0, 0%, 100%, .9);
		border-radius: .6rem;
		font-size: .32rem;
		color: #333;
	}

	.servicedetaile_top_number {
		display: inline;
		color: #E60012;
		padding: 0 5rpx;
		/* font-weight: 700; */
	}

	.servicedetaile_line {
		width: 100%;
		height: 2rpx;
		background: #e1e2e3;
		margin: 1.5rem 0 .8rem;
	}

	.servicedetaile_textbox {
		margin-bottom: 30rpx;
	}

	.servicedetaile_textboxs {
		font-size: 28rpx;
		margin-bottom: 30rpx;
		margin-top: 30rpx;
		color: #666666;
	}

	.servicedetaile_textbox .textbox_left {
		display: inline-block;
		width: 5.293333rem;
		white-space: nowrap;
		font-size: .32rem;
		color: #999;
		text-align: right;
	}

	.servicedetaile_textbox .textbox_right {
		display: inline-block;
		/* width: 4.293333rem; */
		white-space: nowrap;
		font-size: .32rem;
		color: #333333;
	}

	.service_bottom {
		position: fixed;
		left: 0;
		bottom: 0;
		z-index: 4;
		width: 100%;
		height: 3rem;
		background: #fff;
		box-shadow: 0 1rpx 20rpx #d5d5d5;
		padding: .533333rem .866667rem;
	}

	.service_bottom button {
		width: 100%;
		height: 2.066667rem;
		background: #f6685a;
		font-size: .426667rem;
		color: #fff;
		border: none;
		border-radius: .533333rem;
	}

	.popup_box {
		width: 100%;

		height: auto;
		background-color: #FFFF;
		border-radius: 15rpx 15rpx;
		padding: 30rpx 30rpx;
	}

	.line_box {
		position: relative;
		margin: 20rpx 0rpx;
	}

	.popup-lable {
		position: absolute;
		top: 10rpx;
		left: ;
		font-size: 28rpx;
		display: inline-block;
		width: 230rpx;
		line-height: 50rpx;

	}

	.popup-input {
		margin-left: 250rpx;
		font-size: 28rpx;
		display: inline-block;
		width: 420rpx;
		padding-left: 30rpx;
		line-height: 60rpx;
		min-height: 60rpx;
		max-height: 60rpx;
		border: 1rpx solid #e1e2e3;
	}

	uni-button:after {
		content: " ";
		width: 200%;
		height: 200%;
		position: absolute;
		top: 0;
		left: 0;
		border: none;
		-webkit-transform: scale(.5);
		transform: scale(.5);
		-webkit-transform-origin: 0 0;
		transform-origin: 0 0;
		box-sizing: border-box;
		border-radius: 10px;
	}

	.popup_bottom {

		width: 100%;
		height: 2.066667rem;
		background: #f6685a;
		font-size: .426667rem;
		color: #fff;
		border: none;
		border-radius: 1rem;
		margin-top: 3rem;

	}

	.popup_bottoms {
		width: 100%;
		height: 2.066667rem;
		background: transparent;
		font-size: .373333rem;
		color: #999;
		border: none;
		border-radius: 1rem;
		margin-top: 1rem;

	}

	.no_dialog {
		width: 100%;
		height: 100rpx;
		background: #f4f4f4;
		line-height: 100rpx;
		text-align: center;
		font-size: 24rpx;
		color: #b4b4b4;

	}
</style>
